import { ref } from 'vue'
import { JSEncrypt } from 'jsencrypt'
export const getLogin = () => {
  const template = ref('default')

  const encryptPwd = (str:string) => {
    const Encrypt = new JSEncrypt({})
    const publicKey = `-----BEGIN PUBLIC KEY-----
          MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC8RqfMVcTx9LIILsIK0yQ/p4OT
          t3GlQh4Nyh5QcJvQ3ZaV7tOzXYXAlMuVcb4oKO3CG0m5TOWnuOsatAkHP2Y0HAVm
          B4frRMbokBSrSrhVjGqaFv/EG86t1jdv8oQWvJTafJ5/LmoB09DubYQCw87Ar8jM
          rONPNFT1SeCrIwZyvwIDAQAB
          -----END PUBLIC KEY-----`
    Encrypt.setPublicKey(publicKey)
    return Encrypt.encrypt(str)
  }
  const getTemplate = async () => {

  }

  return {
    template,
    getTemplate,
    encryptPwd
  }
}
